﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace MvcWiki.Test.Model
{
    public class WikiMarkupFacts
    {
        [Fact]
        public void Can_Be_Created()
        {
            new MvcWiki.Model.WikiMarkup();
        }

        [Fact]
        public void Has_Name_Property()
        {
            var wikiMarkup = new MvcWiki.Model.WikiMarkup();

            string name = wikiMarkup.Name;
        }

        [Fact]
        public void Equals_To_Self()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup();

            Assert.True(wikiMarkup1.Equals(wikiMarkup1));
        }

        [Fact]
        public void Equals_To_Another()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup { Name = "Markup1" };

            var wikiMarkup2 = new MvcWiki.Model.WikiMarkup { Name = "Markup1" };

            Assert.True(wikiMarkup1.Equals(wikiMarkup2));
        }

        [Fact]
        public void Not_Equals_To_Another()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup { Name = "Markup1" };

            var wikiMarkup2 = new MvcWiki.Model.WikiMarkup { Name = "Markup2" };

            Assert.False(wikiMarkup1.Equals(wikiMarkup2));
        }

        [Fact]
        public void Not_Equals_To_Null()
        {
            var wikiMarkup = new MvcWiki.Model.WikiMarkup();

            Assert.False(wikiMarkup.Equals(null));
        }

        [Fact]
        public void Not_Equals_To_Another_Type()
        {
            var wikiMarkup = new MvcWiki.Model.WikiMarkup();

            var obj = new object();

            Assert.False(wikiMarkup.Equals(obj));
        }

        [Fact]
        public void Eq_To_Self()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup();

            var wikiMarkup2 = wikiMarkup1;

            Assert.True(wikiMarkup1 == wikiMarkup2);
        }

        [Fact]
        public void Eq_To_Another()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup { Name = "Namespace1" };

            var wikiMarkup2 = new MvcWiki.Model.WikiMarkup { Name = "Namespace1" };

            Assert.True(wikiMarkup1 == wikiMarkup2);
        }

        [Fact]
        public void Not_Eq_To_Another()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup { Name = "Namespace1" };

            var wikiMarkup2 = new MvcWiki.Model.WikiMarkup { Name = "Namespace2" };

            Assert.True(wikiMarkup1 != wikiMarkup2);
        }

        [Fact]
        public void NotEq_To_Another_Type()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup();

            var wikiMarkup2 = new object();

            Assert.True(wikiMarkup1 != wikiMarkup2);
        }

        [Fact]
        public void Not_Eq_To_Null()
        {
            var wikiMarkup1 = new MvcWiki.Model.WikiMarkup();

            MvcWiki.Model.WikiMarkup wikiMarkup2 = null;

            Assert.True(wikiMarkup1 != wikiMarkup2);
        }

        [Fact]
        public void Can_Convert()
        {
            var content = "content";

            var wikiMarkup = new MvcWiki.Model.WikiMarkup();

            wikiMarkup.Convert(content);
        }

        [Fact]
        public void Convert_Return_The_Same()
        {
            var content = "content";

            var wikiMarkup = new MvcWiki.Model.WikiMarkup();

            var converted = wikiMarkup.Convert(content);

            Assert.Equal<string>(content, converted);
        }
    }
}
